// 七牛云数据初始化
var data_qiniu = {
    domain: 'http://images.xuanfeng.org/',
    action: 'https://upload-z2.qiniup.com/',
    accessKey: '3UFQYGaj5rWpi1UqTtg4JWfoyPTSEY4E-pkWnUOh',
    secretKey: 'J8EpaDZKej1szLuxxHRu0rALrKICsFfFa3Uw-knX',
    scope: 'ckim'
}
/* var data_qiniu = {
    domain: 'https://static.kojo.club/',
    action: 'https://upload-z2.qiniup.com/',
    accessKey: 'rtD2k_hHSxbd1qcjuF6n0MFBflnEQSL1G0Aa9N9G',
    secretKey: 'ulh3bOFRdytNWYH9XfdIbIamebJHuZZojYic5vdi',
    scope: 'static'
} */
// 初始化上传证书
function initUploadToken() {
    var times = parseInt(new Date().getTime() / 1000) + 20000;
    var accessKey = data_qiniu.accessKey;
    var secretKey = data_qiniu.secretKey;
    var putPolicy = {
        "scope": data_qiniu.scope,
        "deadline": times
    };
    var token = getUpToken(accessKey, secretKey, putPolicy);
    return token;
}

// 生成图片名称
function initImageKey(accp) {
    var key = (Number(Math.random().toString().substr(2)) + Date.now()).toString(36);
    var d = new Date();
    var ymd = d.getFullYear() + '' + (d.getMonth() + 1) + '' + d.getDate();
    return accp + '/test/upload/' + ymd + '/' + base64encode(key);
}